home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / xml4j.jar / com / ibm / xml / parser / CM1op.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-08-30  |  2.1 KB  |  106 lines

  1. package com.ibm.xml.parser;
  2.  
  3. import java.util.BitSet;
  4.  
  5. public class CM1op extends CMNode {
  6.    static final long serialVersionUID = -7652557073411492117L;
  7.    int type;
  8.    CMNode node;
  9.  
  10.    public CM1op(int var1, CMNode var2) {
  11.       this.type = var1;
  12.       this.node = var2;
  13.    }
  14.  
  15.    public int getType() {
  16.       return this.type;
  17.    }
  18.  
  19.    public CMNode getNode() {
  20.       return this.node;
  21.    }
  22.  
  23.    public void setNode(CMNode var1) {
  24.       this.node = var1;
  25.    }
  26.  
  27.    public String toString() {
  28.       return this.node.toString() + (char)this.type;
  29.    }
  30.  
  31.    boolean nullable() {
  32.       if (super.nullable == null) {
  33.          boolean var1 = false;
  34.          switch (this.type) {
  35.             case 42:
  36.                var1 = true;
  37.                break;
  38.             case 43:
  39.                var1 = this.node.nullable();
  40.                break;
  41.             case 63:
  42.                var1 = true;
  43.          }
  44.  
  45.          super.nullable = new Boolean(var1);
  46.       }
  47.  
  48.       return super.nullable;
  49.    }
  50.  
  51.    CMNode cloneNode() {
  52.       return new CM1op(this.type, this.node.cloneNode());
  53.    }
  54.  
  55.    BitSet firstpos() {
  56.       if (super.firstPos == null) {
  57.          super.firstPos = this.node.firstpos();
  58.       }
  59.  
  60.       return super.firstPos;
  61.    }
  62.  
  63.    BitSet lastpos() {
  64.       if (super.lastPos == null) {
  65.          super.lastPos = this.node.lastpos();
  66.       }
  67.  
  68.       return super.lastPos;
  69.    }
  70.  
  71.    void prepare(int var1) {
  72.       this.node.prepare(var1);
  73.    }
  74.  
  75.    void setFollowpos(BitSet[] var1) throws LibraryException {
  76.       this.node.setFollowpos(var1);
  77.       if (this.type == 43) {
  78.          throw new LibraryException("com.ibm.xml.parser.CM1op#setFollowpos(): This method should not have been called for plus (+) operator.");
  79.       } else {
  80.          if (this.type == 42) {
  81.             for(int var2 = 0; var2 < var1.length; ++var2) {
  82.                if (this.lastpos().get(var2)) {
  83.                   var1[var2].or(this.firstpos());
  84.                }
  85.             }
  86.          }
  87.  
  88.       }
  89.    }
  90.  
  91.    public boolean equals(Object var1) {
  92.       if (var1 == null) {
  93.          return false;
  94.       } else if (!(var1 instanceof CM1op)) {
  95.          return false;
  96.       } else {
  97.          CM1op var2 = (CM1op)var1;
  98.          return var2.getType() != this.getType() ? false : var2.getNode().equals(this.getNode());
  99.       }
  100.    }
  101.  
  102.    public int hashCode() {
  103.       return this.getNode().hashCode();
  104.    }
  105. }
  106.